home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / xfcn / spttool.cpt / Support Tools eXternals 1.2.5 / card_36512.txt < prev    next >
Text File  |  1990-11-13  |  5KB  |  158 lines

  1. -- card: 36512 from stack: in.5
  2. -- bmap block id: 43181
  3. -- flags: 0000
  4. -- background id: 3858
  5. -- name: MenuShowing
  6. ----- HyperTalk script -----
  7. on HideObjects
  8.   hide cd btn "Try It!"
  9. end HideObjects
  10.  
  11. on ShowObjects
  12.   show cd btn "Try It!"
  13. end ShowObjects
  14.  
  15.  
  16. -- part 1 (button)
  17. -- low flags: 00
  18. -- high flags: A002
  19. -- rect: left=82 top=185 right=219 bottom=175
  20. -- title width / last selected line: 0
  21. -- icon id / first selected line: 0 / 0
  22. -- text alignment: 1
  23. -- font id: 0
  24. -- text size: 12
  25. -- style flags: 8192
  26. -- line height: 16
  27. -- part name: Try it!
  28. ----- HyperTalk script -----
  29. on mouseUp
  30.   global errGlobal
  31.   put MenuBarShowing() into mBarState
  32.   if errGlobal Γëá empty then
  33.     answer "Error: ΓÇ£" & errGlobal & "ΓÇ¥"
  34.     put empty into errGlobal
  35.   else
  36.     if mBarState = true then
  37.       put "is" into theVerb
  38.     else
  39.       put "is not" into theVerb
  40.     end if
  41.     answer "The menu bar" && theVerb && "visible."
  42.   end if
  43. end mouseUp
  44.  
  45.  
  46.  
  47.  
  48. -- part contents for background part 38
  49. ----- text -----
  50. 28/50
  51.  
  52. -- part contents for background part 20
  53. ----- text -----
  54.      Indicates whether the menubar is currently showing.  HyperCard allows users and scripters to hide or show the menu bar (ie. "hide menubar" or "show menubar") but no way to test it's state.
  55.  
  56.      Calling syntax : MenuBarShowing(<ΓÇ£noDialogΓÇ¥:errorGlobal>)
  57.  
  58.      Returns "TRUE" or "FALSE".
  59.  
  60. -- part contents for background part 42
  61. ----- text -----
  62. unit MenuBarShowing;
  63. {}
  64. { Test to see if the menubar is showing.  Look at the height of the menu bar, see if > 0.}
  65. {}
  66. {  brought to you by:  Anup Murarka      Eric Carlson    }
  67. {            ALINK:  SKEPTIC      ALINK:  cyNic  }
  68. {                  CIS:  76004,3356    }
  69. {}
  70. {        We are part of the Support Tools Development Group,  }
  71. {        Apple Computer, Inc.   }
  72. {}
  73. {        please DO NOT contack Mac DTS for support of this code!  }
  74. {}
  75. {        please DO contact the authors for support of this code!  }
  76. {}
  77. {        Send comments, bug reports, requests to any of the above  }
  78. {        E-mail addresses or to:}
  79. {}
  80. {              (one of us)          }
  81. {              Apple Computer, Inc.     }
  82. {              900 E. Hamilton, Ave.    }
  83. {              Campbell, CA   95008    }
  84. {              M/S 72-L          }
  85. {}
  86. {  Copyright:  ┬⌐ 1989, 1990 by Apple Computer, Inc., all rights reserved.  }
  87. {}
  88. { written by Eric Carlson                    }
  89. { AppleLink:  cyNic                        }
  90. { modification history                      }
  91. {       Date        Initials                  Comments              }
  92. {       ----        ------  ------------------------------------------------------}
  93. {    7/27/89      ec       first written                            }
  94. {    8/29/90      ec      modified use GetMBarHeight function rather than low mem  }
  95. {                                   global.  changed version to 1.1  }
  96. {}
  97.  
  98. interface
  99.   uses
  100.     HyperXCMD;
  101.  
  102.   procedure main (paramPtr: XCmdPtr);
  103.  
  104. implementation
  105.  
  106.  
  107.   function askedForHelp (paramPtr: XCmdPtr; syntaxMsg: Str255; copyRightMsg: Str255): boolean;
  108. {}
  109. {  check to see if the user sent a '?' or a '!' as }
  110. { the only parameter. if so we will respond with }
  111. { the calling syntax or the copyright/version info }
  112. { for this external }
  113. {}
  114.     var
  115.       firstStr: str255;
  116.   begin
  117.     askedForHelp := false;
  118.     if paramPtr^.paramCount = 1 then
  119.       begin
  120.         ZeroToPas(paramPtr, paramPtr^.params[1]^, firstStr);
  121.           { what is the first param? }
  122.         if firstStr = '?' then
  123.           begin
  124.             paramPtr^.returnValue := PasToZero(paramPtr, syntaxMsg);
  125.             askedForHelp := true
  126.           end  { asked for help }
  127.         else if firstStr = '!' then
  128.           begin
  129.             paramPtr^.returnValue := PasToZero(paramPtr, copyRightMsg);
  130.             askedForHelp := true
  131.           end;  { asked for copyright info }
  132.       end;  { one parameter passed }
  133.   end;  { function }
  134.  
  135.   function GetMBarHeight: INTEGER;
  136.   inline
  137.     $3EB8, $0BAA;
  138.  
  139.   procedure MenuIsShowing (paramPtr: XCMDPtr);
  140.     var
  141.       menuShowing: boolean;
  142.       copyRtStr, syntaxStr: str255;
  143.   begin
  144.     syntaxStr := 'MenuBarShowing()';
  145.     copyRtStr := 'v1.1, ┬⌐1989, 1990 Apple Computer, Inc., by Eric Carlson';
  146.     if not (askedForHelp(paramPtr, syntaxStr, copyRtStr)) then
  147.       begin
  148.         menuShowing := (GetMBarHeight > 0);
  149.         BoolToStr(paramPtr, menuShowing, syntaxStr);    { borrow the string varΓǪ }
  150.         paramPtr^.returnValue := PasToZero(paramPtr, syntaxStr);
  151.       end;
  152.   end;
  153.  
  154.   procedure main (paramPtr: XCmdPtr);
  155.   begin
  156.     MenuIsShowing(paramPtr);
  157.   end;
  158. end.